package com.xin.jdbc;
/*
  重复写jdbc的代码
 */

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class jdbctest_01 {
    public static void main(String[] args) {
        Connection conn = null;
        Statement sta = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/student_manage", "root", "856736");
            sta = conn.createStatement();
            String sql = "UPDATE student_manage SET stu_di=10 ,stu_name='zhangsan' where sut_id=1";
            String updata="update stu_information set age=19 where stu_id=2 ";
            int counts = sta.executeUpdate("sql1");
            System.out.println(counts);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (sta != null) {
                try {
                    sta.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

